/*
============================================================================
 Name		: pys60AS.cpp
 Author	  : Parvel
 Copyright   : For only test usage
 Description : Cpys60AS DLL source
============================================================================
*/

//  Include Files  

#include "pys60AS.h"	// Cpys60AS
#include "pys60AS.pan"	  	// panic codes


//  Member Functions

EXPORT_C Cpys60AS* Cpys60AS::NewLC()
	{
	Cpys60AS* self = new (ELeave) Cpys60AS;
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}


EXPORT_C Cpys60AS* Cpys60AS::NewL()
	{
	Cpys60AS* self = Cpys60AS::NewLC();
	CleanupStack::Pop(self);
	return self;
	}


Cpys60AS::Cpys60AS()
// note, CBase initialises all member variables to zero
	{
	}


void Cpys60AS::ConstructL()
	{
	// second phase constructor, anything that may leave must be constructed here
	iString = new (ELeave) Tpys60ASExampleString;
	}


EXPORT_C Cpys60AS::~Cpys60AS()
	{
	delete iString;
	}


EXPORT_C TVersion Cpys60AS::Version() const
	{
	// Version number of example API
	const TInt KMajor = 1;
	const TInt KMinor = 0;
	const TInt KBuild = 1;
	return TVersion(KMajor, KMinor, KBuild);
	}


EXPORT_C void Cpys60AS::ExampleFuncAddCharL(const TChar& aChar)
	{
	__ASSERT_ALWAYS(iString != NULL, Panic(Epys60ASNullPointer));

	if (iString->Length() >= Kpys60ASBufferLength)
		{
		User::Leave(KErrTooBig);
		}

	iString->Append(aChar);
	}


EXPORT_C void Cpys60AS::ExampleFuncRemoveLast()
	{
	__ASSERT_ALWAYS(iString != NULL, Panic(Epys60ASNullPointer));

	if (iString->Length() > 0)
		{
		iString->SetLength(iString->Length() - 1);
		}
	}


EXPORT_C const TPtrC Cpys60AS::ExampleFuncString() const
	{
	__ASSERT_ALWAYS(iString != NULL, Panic(Epys60ASNullPointer));
	return *iString;
	}



